/* level.h -- handles reading Lemmings levels (*.lvl)
 * Copyright (C) 2007  Brett McLarnon
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
 * USA.
 *
 * $Id: level.h 7 2007-12-09 06:34:40Z brett.mclarnon $
 */

#ifndef _level_h
#define _level_h

#include <stdio.h>
#include <stdint.h>

#define NUM_SKILLS 8

typedef enum {
    Climber = 0,
    Floater = 1,
    Bomber = 2,
    Blocker = 3,
    Builder = 4,
    Basher = 5,
    Miner = 6,
    Digger = 7
} Skills;

typedef enum {
    Dirt,
    Fire,
    Squasher,
    Pillar,
    Crystal,
    Brick,
    Rock,
    Snow,
    Bubble
} LvlTileset;

typedef enum {
    None        = 0,
    Remove      = 2,
    Flip        = 4,
    OnlyTerrain = 4,
    NoOverwrite = 8,
} LvlModifier;

typedef struct {
    size_t xpos;
    size_t ypos;
    uint8_t id;
    LvlModifier modifier;
} LvlObject;

typedef struct {
    size_t xpos;
    size_t ypos;
    LvlModifier modifier;
    uint8_t id;
} LvlTerrain;

typedef struct {
    size_t xpos;
    size_t ypos;
    size_t height;
    size_t width;
} LvlSteel;

typedef struct {
    char* name;
    size_t releaseRate;
    size_t lemmingCount;
    size_t lemmingRescue;
    size_t timeLimit;
    size_t skills[NUM_SKILLS];
    size_t screenStart;
    LvlTileset tileset;

    size_t levelWidth;
    size_t objectCount;
    size_t terrainCount;
    size_t steelCount;
    LvlObject* object;
    LvlTerrain* terrain;
    LvlSteel* steel;
} Level;

Level* level_load (FILE* stream);
void level_print(Level* lvl);

#endif /* _level_h */
